home
diamond Go Premium
Data Engineering Path  ·  PySpark

Introduction to Spark UI

Level Intermediate to Advanced
Estimated Time ~3 Hours
Curriculum 7 Lessons
Course Mission

"Master the Spark Web UI to understand running jobs and troubleshoot performance issues with confidence."


What You'll Master

Submission Lifecycle

How code turns into a running Job: SparkSession init, lazy DAG construction, Catalyst optimization, & task scheduling.

Jobs & Executors Tabs

Reading the event timeline & DAG visualization, plus JVM heap, GC time, and shuffle read/write per executor.

SQL Tab & Physical Plans

Tracing the physical execution DAG, operator-level row/spill metrics, and spotting shuffle vs broadcast joins.

Diagnosing Skew & Bottlenecks

Using the Stages, Storage & Environment tabs to catch data skew, cache pressure, and misapplied configs.


The Spark Web UI is the most powerful diagnostic tool available to a Spark developer. It provides a real-time, visual window into the internals of your running Spark application, helping you monitor performance, debug failures, and identify bottlenecks (like data skew, garbage collection overhead, or excessive serialization).

The Life Cycle: What Happens When Code is Submitted?

Understanding the interaction between your code, the driver, the executors, and the Web UI is critical to mastering Spark. Here is the step-by-step lifecycle of a Spark submission and how the Web UI renders it:

flowchart TD
    subgraph S1["1-2 . Submission and Lazy Planning"]
        direction LR
        A["Submit Code"] --> B["Init SparkSession"] --> C["Driver Starts Web UI :4040"] --> D["Lazy Transformation"] --> E["Appended to Lineage DAG"]
    end
    subgraph S2["3 . Action Triggers a Job"]
        direction LR
        F["Action Triggered"] --> G["Catalyst Builds Physical Plan"]
    end
    subgraph S3["4-5 . Scheduling and Live Monitoring"]
        direction LR
        H["DAGScheduler Creates Stages"] --> I["TaskScheduler Launches Tasks"] --> J["Executors Send Heartbeats"] --> K["Web UI Renders Live Metrics"]
    end
    S1 --> S2 --> S3

Figure 1 — The Spark submission lifecycle, from code submission through to live metrics on the Web UI.

1. SparkSession Initialization & Driver Web Server

When you submit a Spark application (using spark-submit or running a cell in a notebook), the Driver process is launched. One of the very first things the Driver does is initialize the SparkContext.

  • During this initialization, the driver starts a local, embedded Jetty web server.
  • By default, it binds to port 4040 (e.g., http://localhost:4040).
  • Note: If another Spark application is already running on port 4040, Spark will automatically increment the port (4041, 4042, etc.) until it finds an open one.

2. Lazy Execution & DAG Construction

Spark transformations (like .map(), .filter(), or .groupBy()) are lazy. They do not trigger actual computation; they merely build up a Logical Plan (represented as a Directed Acyclic Graph or DAG of operations).

  • During this phase, the Web UI remains idle, showing no active jobs.

3. Action Triggering & Physical Optimization

The moment you invoke an Action (such as .count(), .collect(), .show(), or .write()), the Driver triggers a Spark Job.

  • Under the hood, Spark's Catalyst Optimizer takes the logical plan and optimizes it, generating a highly efficient Physical Execution Plan.
  • The SQL Tab in the Web UI immediately updates to render this physical plan.

4. Job Scheduling (DAGScheduler & TaskScheduler)

The optimized plan is handed to the DAGScheduler:

  • The DAGScheduler divides the Job into Stages based on shuffle boundaries (wide transformations like join or groupByKey require data movement and split stages; narrow transformations like map or filter are pipelined together in the same stage).
  • The TaskScheduler then takes the stages and breaks them down into individual Tasks (one task per data partition). It schedules these tasks and sends them to the Executors for physical execution.

5. Heartbeat & Real-Time Metrics Rendering

As tasks run on the executors, the executors continuously send Heartbeat messages back to the Driver (every 10 seconds by default).

  • These heartbeats carry critical metrics: CPU utilization, JVM garbage collection time, memory usage, bytes read/written, and shuffle write sizes.
  • The Driver gathers these metrics and feeds them to the Web UI, updating the Jobs, Stages, and Executors tabs in real-time.

Deep-Dive: Key Web UI Tabs Explained

Let's explore the core screens of the Web UI using actual renders of running applications.

1. The Jobs Tab (Global Overview)

The Jobs Tab is the landing page of the Spark UI. It provides an event timeline of all active, completed, and failed jobs.

Note

A single Spark application can run multiple Jobs. Each Job corresponds to exactly one Action called in your code.

Spark Jobs Tab — list of all Jobs in a running application, with succeeded/total stage and task progress Figure 2 — Jobs Tab: every Job in a running application, with stage and task progress.

Key Features to Watch:
  • Event Timeline: Shows when executors were added or removed and when specific jobs started and finished.
  • DAG Visualization: Displays the sequence of RDD/DataFrame transformations grouped into Stages. You can visually trace how data flows from your source (e.g., a Parquet file scan) through transformations like flatMap, map, and filter, and where stage boundaries (vertical lines marked "Shuffle") occur.
  • Succeeded/Total Stages: Displays task execution progress so you can instantly see if a stage is bottlenecked or stuck.

» Full walkthrough: The Jobs & Stages Tabs


2. The Executors Tab (Resource Monitoring)

The Executors Tab provides hardware-level statistics for the Driver and all active Executors. It is your primary tool for diagnosing hardware bottlenecks and resource exhaustion.

Spark Executors Screen Figure 3 — Executors Tab: per-executor resource usage, GC time, and shuffle read/write.

Key Features to Watch:
  • JVM Heap Memory Usage: Displays the exact memory allocated for execution and storage, along with JVM garbage collection (GC) metrics.
  • GC Time / Executor Run Time: If GC time represents more than 10% of the total executor run time, it is a warning sign that executors are running low on memory, forcing the JVM to spend excessive time reclaiming space.
  • Shuffle Read / Shuffle Write: Shows how much data each executor is transferring across the network during wide transformations. Uneven shuffle distribution is a clear indicator of Data Skew.

» Full walkthrough: The Executors Tab


3. The SQL Tab (Execution Optimizer)

The SQL Tab shows detailed execution trees for structural API queries (DataFrames and Spark SQL). It bridges the gap between your high-level code and physical execution.

Spark SQL Query DAG Figure 4 — SQL Tab: the physical execution plan Catalyst generated for a DataFrame join.

Key Features to Watch:
  • Physical Plan DAG: Every node in this interactive graph represents a physical execution operator (e.g., FileScan parquet, Filter, Project, BroadcastExchange, and BroadcastHashJoin).
  • Operator Metrics: Renders real-time statistics directly inside each node, such as:
  • Number of output rows
  • Scan time
  • Spill sizes (memory/disk)
  • Join Details: Instantly verify if Spark is using an optimal join strategy (like a super-fast BroadcastHashJoin) or falling back to a slower, resource-heavy shuffle-based join.

» Full walkthrough: The SQL Tab


4. Additional Crucial Tabs

  • Stages Tab: Drill down into a specific stage to inspect task distribution. If a few tasks are taking hours while the rest finish in seconds, you have identified a Data Skew or an uneven partition size.
  • Storage Tab: Displays cached or persisted DataFrames/RDDs. It shows the memory fraction cached, storage level (e.g., Memory and Disk Deserialized 1x), and size on disk/memory.
  • Environment Tab: Displays all runtime configurations, active environment variables, JVM system properties, and specific Spark configurations (spark.driver.memory, spark.sql.shuffle.partitions, etc.). Use this to verify that your cluster configuration changes have actually taken effect!

» Full walkthrough: Stages, Storage & Environment Tabs


Summary: Diagnostic Cheat Sheet

Symptom Web UI Tab to Inspect What to Look For Solution
Job stuck at 199/200 tasks Stages Tab Max task duration is 100x larger than the Median task duration. Implement Salting or adjust partition keys.
Out Of Memory (OOM) Errors Executors Tab JVM Heap Memory usage bar is high; GC Time is > 10% of Run Time. Increase executor memory, tune serialization, or optimize caching.
Slow Join Performance SQL Tab Look for SortMergeJoin without a broadcast when joining small tables. Force a broadcast join using broadcast(df).
Spilling to Disk Stages Tab "Spill (Memory)" and "Spill (Disk)" columns contain positive sizes. Increase executor memory or increase partition counts to reduce partition sizes.

Learning Path & Course Syllabus

Reading the DAG visualization, spotting shuffle boundaries, and diagnosing skew from the task duration summary.

Diagnosing GC pressure, uneven shuffle load, and dead executors with a worked example.

Reading physical plan operators, spotting missed broadcast joins, and interpreting spill metrics.

Confirming skew across an entire run, verifying your cache is actually cached, and checking which configs really took effect.

Practical exercises reading real Jobs, Executors, and SQL tab screenshots to spot bottlenecks.

Conceptual questions on DAG scheduling, shuffle boundaries, and diagnosing skew from UI metrics.


What's Included in This Module

Component Coverage Details
Core Topics Driver & Executor Architecture, Cluster Managers, Datasets
Practical Exercises Interactive Hands-on Labs & Spark Tasks
Assessments 1 Practical Assignment + 1 System Design Interview Quiz
Find this content helpful? ☕ Buy me a coffee

Entity Details

Create New Item

celebration
Enjoying the free content?

Create a free account to track your progress and save your place.

Create Free Account
help

Submit Technical Query

Have a question or run into an issue? Describe it below, upload an optional screenshot, and our engineering team will answer it!

image Attach image (optional)

Submit Feedback

build Free Developer Utility Free Tool
gavel

Privacy & Legal Disclaimer

1. Client-Side Browser Processing

All utility tools on DeepEngineerHub (including Image to PDF, Text Formatters, JSON Converters, and Encryptors) execute 100% locally within your client browser using WebAssembly and JavaScript. No uploaded images, text, or documents are transmitted, collected, or stored on remote servers.

2. Limitation of Liability ("As-Is" Provision)

Tools and services are provided free of charge for convenience and educational purposes "as-is" without warranties of any kind. DeepEngineerHub shall not be held liable for any data loss, formatting inconsistencies, or indirect damages resulting from tool usage.

3. Open Source & Third-Party Software

Certain utilities utilize open-source client libraries (such as jsPDF, Mermaid.js, Pyodide) licensed under MIT, Apache, or BSD open licenses. All intellectual property remains with their respective copyright holders.